package com.student.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.student.entity.Student;
import com.student.service.studentService;

public class deleteStudentServlet extends HttpServlet{
	 @Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 request.setCharacterEncoding("utf-8");
		 String uid=request.getParameter("uid");
//		 System.out.println(uid);
		 studentService service=new studentService();
		 boolean result=service.deleteStudent(uid);
		 if(result){
		 	response.getWriter().println("delete "+uid+"successfully!");
			response.sendRedirect("selectStudentsServlet");
		 }else{
		 	response.getWriter().println("delete failed!");
			 System.err.println("failed!");
			 response.sendRedirect("login.jsp");
		 }

	}
	 @Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

	}
}
